import request from './request'

/**
 * Order related API
 */
export const orderAPI = {
  /**
   * Get order list
   */
  getList(params) {
    return request({
      url: '/orders',
      method: 'get',
      params
    })
  },

  /**
   * Get order details
   */
  getDetail(id) {
    return request({
      url: `/orders/${id}`,
      method: 'get'
    })
  },

  /**
   * Create order
   */
  create(data) {
    return request({
      url: '/orders',
      method: 'post',
      data
    })
  },

  /**
   * Update order status
   */
  updateStatus(id, data) {
    return request({
      url: `/orders/${id}/status`,
      method: 'put',
      data
    })
  },

  /**
   * Delete order
   */
  delete(id) {
    return request({
      url: `/orders/${id}`,
      method: 'delete'
    })
  }
}
